package com.itcast.n1_内存调优;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
 * @program: jvm
 * @description:
 * @author: flyduck
 * @create: 2024-10-16 14:38
 **/
public class Test04_解决内存泄漏_内存泄漏时内存占用走势 {
    public static long count = 0;
    public static Map<Student1,Long> map = new HashMap<>();
    public static void main(String[] args) throws InterruptedException {
        while (true){
            if(count++ % 100 == 0){
                Thread.sleep(10);
            }
            Student1 student1 = new Student1();
            student1.setId(1);
            student1.setName("张三");
            map.put(student1,1L);
        }
    }
}

@Data
class Student1 {
    private int id;
    private String name;
    private byte[] bytes = new byte[1024 * 1024];
}
